﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HenIT.Text
{
    #region StringValueAttribute and StringValueAttributeUtil
    public class StringValueAttribute : Attribute
    {
        public string StringExpandedValue;
        public string StringValue;

        public StringValueAttribute(string value, string stringExpandedValue)
        {
            this.StringValue = value;
            this.StringExpandedValue = stringExpandedValue;
        }
    }
    internal static class StringValueAttributeUtil
    {
        public static string GetStringValue(Enum value)
        {
            // Get the type
            Type type = value.GetType();

            // Get fieldinfo for this type
            System.Reflection.FieldInfo fieldInfo = type.GetField(value.ToString());
            // Get the stringvalue attributes
            StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
                typeof(StringValueAttribute), false) as StringValueAttribute[];
            // Return the first if there was a match.
            return attribs.Length > 0 ? attribs[0].StringValue : null;
        }
        public static string GetStringExpandedValue(Enum value)
        {
            // Get the type
            Type type = value.GetType();

            // Get fieldinfo for this type
            System.Reflection.FieldInfo fieldInfo = type.GetField(value.ToString());
            // Get the stringvalue attributes
            StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
                typeof(StringValueAttribute), false) as StringValueAttribute[];
            // Return the first if there was a match.
            return attribs.Length > 0 ? attribs[0].StringExpandedValue : null;
        }
    } 
    #endregion

    #region Enums
    public enum HTMLSpecialLetterCharacter
    {
        [StringValue("à", "&agrave;")]
        Agrave,             //à
        [StringValue("á", "&aacute;")]
        Aacute,             //á
        [StringValue("â", "&acirc;")]
        Acirc,              //â
        [StringValue("ã", "&atilde;")]
        Atilde,             //ã
        [StringValue("ä", "&auml;")]
        Auml,               //ä
        [StringValue("å", "&aring;")]
        Aring,              //å
        [StringValue("è", "&egrave;")]
        Egrave,             //è
        [StringValue("é", "&eacute;")]
        Eacute,             //é
        [StringValue("ê", "&ecirc;")]
        Ecirc,              //ê
        [StringValue("ë", "&euml;")]
        Euml,               //ë
        [StringValue("ì", "&igrave;")]
        Igrave,             //ì
        [StringValue("í", "&iacute;")]
        Iacute,             //í
        [StringValue("î", "&icirc;")]
        Icirc,              //î
        [StringValue("ï", "&iuml;")]
        Iuml,               //ï
        [StringValue("ñ", "&ntilde;")]
        Ntilde,             //ñ
        [StringValue("ò", "&ograve;")]
        Ograve,             //ò
        [StringValue("ó", "&oacute;")]
        Oacute,             //ó
        [StringValue("ô", "&ocirc;")]
        Ocirc,              //ô
        [StringValue("õ", "&otilde;")]
        Otilde,             //õ
        [StringValue("ö", "&ouml;")]
        Ouml,               //ö
        [StringValue("ù", "&ugrave;")]
        Ugrave,             //ù
        [StringValue("ú", "&uacute;")]
        Uacute,             //ú
        [StringValue("û", "&ucirc;")]
        Ucirc,              //û
        [StringValue("ü", "&uuml;")]
        Uuml,               //ü
        [StringValue("ý", "&yacute;")]
        Yacute,             //ý
        [StringValue("ÿ", "&yuml;")]
        Yuml,               //ÿ
        [StringValue("À", "&Agrave;")]
        UAgrave,            //À
        [StringValue("Á", "&Aacute;")]
        UAacute,            //Á
        [StringValue("Â", "&Acirc;")]
        UAcirc,             //Â
        [StringValue("Ã", "&Atilde;")]
        UAtilde,            //Ã
        [StringValue("Ä", "&Auml;")]
        UAuml,              //Ä
        [StringValue("Å", "&Aring;")]
        UAring,             //Å
        [StringValue("È", "&Egrave;")]
        UEgrave,            //È
        [StringValue("É", "&Eacute;")]
        UEacute,            //É
        [StringValue("Ê", "&Ecirc;")]
        UEcirc,             //Ê
        [StringValue("Ë", "&Euml;")]
        UEuml,              //Ë
        [StringValue("Ì", "&Igrave;")]
        UIgrave,            //Ì
        [StringValue("Í", "&Iacute;")]
        UIacute,            //Í
        [StringValue("Î", "&Icirc;")]
        UIcirc,             //Î
        [StringValue("Ï", "&Iuml;")]
        UIuml,              //Ï
        [StringValue("Ñ", "&Ntilde;")]
        UNtilde,            //Ñ
        [StringValue("Ò", "&Ograve;")]
        UOgrave,            //Ò
        [StringValue("Ó", "&Oacute;")]
        UOacute,            //Ó
        [StringValue("Ô", "&Ocirc;")]
        UOcirc,             //Ô
        [StringValue("Õ", "&Otilde;")]
        UOtilde,            //Õ
        [StringValue("Ö", "&Ouml;")]
        UOuml,              //Ö
        [StringValue("Ù", "&Ugrave;")]
        UUgrave,            //Ù
        [StringValue("Ú", "&Uacute;")]
        UUacute,            //Ú
        [StringValue("Û", "&Ucirc;")]
        UUcirc,             //Û
        [StringValue("Ü", "&Uuml;")]
        UUuml,              //Ü
        [StringValue("Ý", "&Yacute;")]
        UYacute,            //Ý
        [StringValue("Ÿ", "&Yuml;")]
        UYuml,
    }
    public enum HTMLSpecialSymbolCharacter
    {
        [StringValue("`", "&grave;")]
        Grave,
        [StringValue("´", "&acute;")]
        Acute,
        [StringValue("÷", "&divide;")]
        Divide,             //÷
        [StringValue("ø", "&oslash;")]
        Oslash,             //ø
        [StringValue("Ø", "&Oslash;")]
        UOslash,            //Ø
        [StringValue("×", "&times;")]
        Times,              //×
        [StringValue("©", "&copy;")]
        Copy,
        [StringValue("®", "&reg;")]
        Reg,
        [StringValue("¹", "&sub1;")]
        Sub1,
        [StringValue("²", "&sub2;")]
        Sub2,
        [StringValue("³", "&sub3;")]
        Sub3,
        [StringValue("¼", "&frac14;")]
        Frac14,
        [StringValue("½", "&frac12;")]
        Frac12,
        [StringValue("¾", "&frac34;")]
        Frac34,
        [StringValue("º", "&ordm;")]
        Ordm,
        [StringValue("°", "&deg;")]
        Deg,
        [StringValue("«", "&laquo;")]
        Laquo,
        [StringValue("»", "&raquo;")]
        Raquo,
        [StringValue("±", "&plusmn;")]
        Plusmn,
        [StringValue("ª", "&ordf;")]
        Ordf,
        [StringValue("¶", "&para;")]
        Para,
        [StringValue("§", "&sect;")]
        Sect,
        [StringValue("¨", "&uml;")]
        Uml,
        [StringValue("¸", "&cedil;")]
        Cedil,
        [StringValue("¬", "&not;")]
        Not,
        [StringValue("µ", "&micro;")]
        Micro,
        [StringValue("¯", "&macr;")]
        Macr,
        [StringValue("¦", "&brvbar;")]
        Brvbar,
        [StringValue("¡", "&iexcl;")]
        Iexcl,
        [StringValue("Ç", "&Ccedil;")]
        UCcedil,
        [StringValue("Þ", "&THORN;")]
        THORN,
        [StringValue("ß", "&szlig;")]
        Szlig,
        [StringValue("æ", "&aelig;")]
        Aelig,
        [StringValue("ç", "&ccedil;")]
        Ccedil,
        [StringValue("ð", "&eth;")]
        Eth,
        [StringValue("Œ", "&OElig;")]
        UOElig,
        [StringValue("œ", "&oelig;")]
        Oelig,
        [StringValue("Š", "&Scaron;")]
        UScaron,
        [StringValue("š", "&scaron;")]
        Scaron,
        [StringValue("ƒ", "&fnof;")]
        Fnof,
        [StringValue("ˆ", "&circ;")]
        Circ,
        //[StringValue("", "&tilde;")] //VS editor does not allow this character
        //Tilde,
        [StringValue("†", "&dagger;")]
        Dagger,
        [StringValue("‡", "&Dagger;")]
        UDagger,
        [StringValue("•", "&bull;")]
        Bull,
        [StringValue("…", "&hellip;")]
        Hellip,
        [StringValue("‰", "&permil;")]
        Permil,
        [StringValue("′", "&prime;")]
        Prime,
        [StringValue("″", "&prime;")]
        UPrime,
        [StringValue("‹", "&lsaquo;")]
        Lsaquo,
        [StringValue("›", "&rsaquo;")]
        Rsaquo,
        [StringValue("‾", "&oline;")]
        Oline,
        [StringValue("⁄", "&frasl;")]
        Frasl,
        [StringValue("™", "&trade;")]
        Trade,
        [StringValue("–", "&ndash;")]
        Ndash,
        [StringValue("‘", "&lsquo;")]
        Lsquo,
        [StringValue("’", "&rsquo;")]
        Rsquo,
        [StringValue("“", "&ldquo;")]
        Ldquo,
        [StringValue("”", "&rdquo;")]
        Rdquo,
        [StringValue("„", "&bdquo;")]
        Bdquo,
    }
    public enum HTMLSpecialCharacter
    {
        [StringValue("<", "&lt;")]
        LessThanSign,       //<
        [StringValue(">", "&gt;")]
        GreaterThanSign,    //>
        [StringValue("\"", "&quot;")]
        DoubleQuote,        //"
        [StringValue("'", "&apos;")]
        SingleQuote,        //'
        [StringValue("&", "&amp;")]
        Ampersand,          //

    } 
    #endregion
}
